package aplicacion.proxy;

import java.io.Serializable;
import java.util.Hashtable;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import fac.Facade;
import framework.ProxyModelo;
import vo.ArticuloVO;

public class ProxyNvoArt extends ProxyModelo implements Serializable{
	
	public ProxyNvoArt()
	{
		
		super();
		String naming = "FacadeEAR/FacadeBean/remote";
		Hashtable props = new Hashtable();
		props.put(InitialContext.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
		props.put(InitialContext.PROVIDER_URL, "jnp://127.0.0.1:1099");
		InitialContext ic;
		
		try {
			ic = new InitialContext(props);
			Facade a=(Facade)ic.lookup(naming);
			if(a!=null)
			{
				System.out.println("Se logro conectar al JBoss");
			}
						
			ArticuloVO articuloVO = new ArticuloVO();
			
			//---------------------------carga de datos test;
			articuloVO.ArticuloVOTEST(articuloVO);
			a.NuevoArt(articuloVO);//Proceso de nuevo Articulo pasando un oBjeto desde el cliente al server.
						
			
		} catch (NamingException e) {
			System.out.println("Error al conectarse al JBoss");
			e.printStackTrace();
		}
	}




}
